
package nav;

import java.util.Collection;
import java.util.HashMap;

public class StreetCollectionImpl implements ICollection {
	
	private HashMap<String, StreetTopologyObjectImpl> streets;
    
	public StreetCollectionImpl(){
		streets = new HashMap<String, StreetTopologyObjectImpl>();
    }

    public void add(Object o) {
        streets.put(((StreetTopologyObjectImpl)o).getID(),(StreetTopologyObjectImpl)o);
    }
    
    public void remove(Object o){
    	streets.remove(o);
    }

    public void read(String source) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public String write() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public StreetTopologyObjectImpl getStreet(String id){
    	return streets.get(id);
    }
    
    public Collection<StreetTopologyObjectImpl> getAllStreets(){
    	return streets.values();
    }
    
    public boolean exists(String id){
    	if (streets.containsKey(id))
    		return true;
    	else
    		return false;
    }
    
}
